# Maintainer: Jaroslav Lichtblau <svetlemodry@archlinux.org>
# Maintainer: Bruno Pagani <archange@archlinux.org>
# Contributor: dibblethewrecker dibblethewrecker.at.jiwe.dot.org
# Contributor: William Rea <sillywilly@gmail.com>

pkgname=postgis
pkgver=3.4.0
pkgrel=1
pkgdesc="A spatial database extender for PostgreSQL"
arch=(loong64 x86_64)
url="https://postgis.net/"
license=(GPL)
depends=(postgresql gdal geos json-c libxml2 proj protobuf-c pcre2)
optdepends=('perl: for contrib script postgis_restore.pl')
makedepends=(clang15 llvm15)
changelog=$pkgname.changelog
source=(https://download.osgeo.org/postgis/source/${pkgname}-${pkgver}.tar.gz)
sha256sums=('aee9b60a6c884d354164b3096c4657f324454186607f859d1ce05d899798af9d')
b2sums=('a7ae007edb12a796f58b24ec8f72264e154900335a2da8c9358dcf0455a4ff183bb77036f45a77aa3533913ab2a802a4995ce17913ef355c52e5c1d8132c04a6')

prepare() {
  cd ${pkgname}-${pkgver}
  autoreconf -vfi
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
}
